﻿<EpiDashboard:GadgetBase x:Class="EpiDashboard.Gadgets.Charting.ScatterChartGadget"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:EpiDashboard="clr-namespace:EpiDashboard"
             xmlns:Controls="clr-namespace:EpiDashboard.Controls"
             xmlns:charting="clr-namespace:ComponentArt.Win.DataVisualization.Charting;assembly=ComponentArt.Win.DataVisualization.Charting"
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="600"
                         SnapsToDevicePixels="True"
             Style="{DynamicResource gadgetBaseStyle}">
    <EpiDashboard:GadgetBase.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../../ResourceDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </EpiDashboard:GadgetBase.Resources>
    <Grid>
        <Border Name="borderAll" Style="{DynamicResource mainGadgetBorder}" Background="White" >
            <Border.ContextMenu>
                <ContextMenu x:Name="gadgetContextMenu">
                    <MenuItem x:Name="mnuSendDataToHTML" Header="Send to web browser" />
                    <MenuItem x:Name="mnuSaveChartAsImage" Header="Save chart as image..." Click="mnuSaveChartAsImage_Click" />
                    <MenuItem x:Name="mnuCopyChartImage" Header="Copy chart image to clipboard" Click="mnuCopyChartImage_Click" />
                    <MenuItem x:Name="mnuCopyChartData" Header="Copy chart data to clipboard" Click="mnuCopyChartData_Click" />
                    <Separator/>
                    <MenuItem x:Name="mnuSendToBack" Header="Send gadget to back"/>
                    <MenuItem x:Name="mnuClose" Header="Close this gadget"/>
                </ContextMenu>
            </Border.ContextMenu>

            <Grid x:Name="grdMain">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="1" />
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>

                <Controls:GadgetHeaderPanel x:Name="headerPanel" Grid.Row="0" IsDescriptionButtonAvailable="False" IsFilterButtonAvailable="False" Text="Scatter Chart" />
                <Controls:GadgetMessagePanel Margin="4" x:Name="messagePanel" Grid.Row="2" Text="" />
                <Controls:GadgetDescriptionPanel Grid.Row="4" PanelMode="Collapsed" x:Name="descriptionPanel"></Controls:GadgetDescriptionPanel>

                <Controls:GadgetInfoPanel Grid.Row="6" Visibility="Collapsed" Margin="4" x:Name="infoPanel"></Controls:GadgetInfoPanel>
                <StackPanel Grid.Row="7" x:Name="panelMain" HorizontalAlignment="Left" VerticalAlignment="Top">
                    <Grid x:Name="gridChartLayoutRoot">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>

                        <!--<TextBlock x:Name="tblockChartTitle" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" Margin="0, 6, 0, 6" Visibility="Collapsed" /> -->
                       
                        <Canvas x:Name="yAxisLabelCanvas" Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Width="25" Height="Auto">
                            <TextBlock x:Name="tblockYAxisLabel" FontWeight="DemiBold" Canvas.Bottom="0" Canvas.Left="0" TextAlignment="Center" Margin="0,0,0,0" Text="Count" Visibility="Collapsed" >                    
                                <TextBlock.RenderTransform>
                                    <TransformGroup>                                
                                        <RotateTransform x:Name="rotate" Angle="270" />
                                    </TransformGroup>
                                </TextBlock.RenderTransform>
                            </TextBlock>
                        </Canvas>
                       
                        <TextBlock x:Name="tblockXAxisLabel" FontWeight="DemiBold" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="0, 0, 0, 6" Visibility="Collapsed" />

                        <charting:XYChart x:Name="xyChart" Background="White" Grid.Row="0" Grid.Column="1" DataStructureCreated="xyChart_DataStructureCreated" DataPointSubsamplingEnabled="False" AllowFractionalPointXRange="True">
                            <charting:XYChart.XAxisArea>
                                <charting:AxisCoordinates x:Name="xAxisCoordinates" Angle="0">
                                </charting:AxisCoordinates>
                            </charting:XYChart.XAxisArea>
                            <charting:XYChart.Axes>
                                <charting:Axis Id="YAxis" x:Name="yAxis" />
                                <charting:Axis Id="XAxis" x:Name="xAxis" />
                            </charting:XYChart.Axes>
                            <charting:MarkerSeries x:Name="series0" Id="S0" XPath="X" YPath="Y" StrokeThickness="4" ShowPointAnnotations="False" />
                            <charting:LineSeries x:Name="series1" Id="S1" XPath="X" YPath="Z" LineKind="Auto" /> 
                            <!--<charting:SeriesAnnotationTracker SeriesIdsCSS="S0" />
                            <charting:SeriesTracker SeriesId="S0" MarkerSize="6" />-->

                            <!--<charting:CoordinateStripes AxisId="YAxis">
                                <charting:CoordinateStripes.Coordinates>
                                    <charting:NumericCoordinates x:Name="stripeCoordinates" From="30" To="40" />
                                </charting:CoordinateStripes.Coordinates>
                                <charting:CoordinateStripes.StripeTemplate>
                                    <DataTemplate>
                                        <Border Background="#23FFB119">
                                            <TextBlock x:Name="stripeText" Text="Warning" FontSize="26" FontWeight="Bold" FontFamily="Calibri" Foreground="#FFFFB119" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="10,0,0,0">
									<TextBlock.Effect>
										<DropShadowEffect BlurRadius="2" ShadowDepth="2" Opacity="0.25" />
									</TextBlock.Effect>
                                            </TextBlock>
                                        </Border>
                                    </DataTemplate>
                                </charting:CoordinateStripes.StripeTemplate>
                            </charting:CoordinateStripes>-->
                        </charting:XYChart>
                        <StackPanel Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" >
                            <TextBlock x:Name="tblockChartTitle"   HorizontalAlignment="Center" FontSize="22" FontWeight="Bold"  Margin="0, 0, 0, 6" Visibility="Collapsed"   />
                            <TextBlock x:Name="tblockChartSubTitle"  HorizontalAlignment="Center" FontSize="18" FontWeight="Bold" Margin="0, 0, 0, 10" Visibility="Collapsed" />
                        </StackPanel>
                        <StackPanel Grid.Row="0" Grid.Column="1" x:Name="panelFormula" Visibility="Collapsed" >
                            <Border BorderBrush="Gray" BorderThickness="1" HorizontalAlignment="Left" VerticalAlignment="Top">
                                <StackPanel Margin="5">
                                    <TextBlock x:Name="tblockEquation">y=mx+b</TextBlock>
                                </StackPanel>
                            </Border>
                        </StackPanel>
                      </Grid>
                </StackPanel>
                <Controls:GadgetWaitPanel x:Name="waitPanel" Visibility="Collapsed" Grid.Row="1" Grid.RowSpan="6" Style="{StaticResource gadgetWaitPanelStyle}" />

                <StackPanel Grid.Row="1" Grid.RowSpan="7" Margin="00,-15,-10,0"  HorizontalAlignment="Right" VerticalAlignment="Top"  >
                    <Grid x:Name="ConfigGrid" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,15,10,0" >
                        <Rectangle Style="{DynamicResource rectangleConfigOuter}" />
                        <Rectangle Style="{DynamicResource rectangleConfigInner}" />

                        <Path x:Name="pathTriangle" 
                              Margin="0,-2,90,0"
                              Data="M 5 0 L 10 10 0 10 Z" Fill="{DynamicResource gadgetBackgroundBrush}" IsHitTestVisible="False" HorizontalAlignment="Right" VerticalAlignment="Top" Height="7" />

                        <StackPanel Orientation="Vertical" Margin="25, 10, 25, 25" HorizontalAlignment="Center" VerticalAlignment="Top" Visibility="Collapsed">
                        </StackPanel>
                    </Grid>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</EpiDashboard:GadgetBase>
